import 'package:library_base/entities/event/progress_refresh_event.dart';
import 'package:library_base/entities/event/scheduled_refresh_event.dart';
import 'package:library_base/entities/event/scheduled_filter_event.dart';
import 'package:library_base/entities/event/progress_filter_event.dart';
import 'package:library_base/event/event.dart';
import 'package:flutter/material.dart';
import 'package:library_base/provider/base_controller.dart';
import 'package:get/get.dart';

class DispatcherMainController extends BaseController {
  late TabController tabController;

  String stationTimeBegin0 = '';

  String stationTimeBegin1 = '';

  Rx<int> count = 0.obs;

  Rx<int> count1 = 0.obs;

  void reset() {
    if (tabController.index == 0) {
      Event.eventBus.fire(ScheduledRefreshEvent());
    } else {
      Event.eventBus.fire(ProgressRefreshEvent());
    }
  }

  void filter(String time) {
    if (tabController.index == 0) {
      stationTimeBegin0 = time;
      Event.eventBus.fire(ScheduledFilterEvent(time));
    } else {
      stationTimeBegin1 = time;
      Event.eventBus.fire(ProgressFilterEvent(time));
    }
  }
}
